package com.ashley.day_0405;

import java.util.Scanner;

public class ForTest2 {

	public static void main(String[] args) {
		Scanner scan = new Scanner(System.in);
		System.out.println("请输入第一个正整数：");
		int m = scan.nextInt();
		System.out.println("请输入第二个正整数：");
		int n = scan.nextInt();
		int min = (m < n) ? m : n;
		for (int i = min; i >= 1; i--) {
			if (m % i == 0 && n % i == 0) {
				System.out.println("最大公约数为：" + i);
				break;
			}
		}
		int max = (m > n) ? m : n;
		for (int j = max; j <= m * n; j++) {
			if (j % m == 0 && j % n == 0) {
				System.out.println("最大公倍数为：" + j);
				break;
			}
		}
	}

}
